-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support showing NSX LB SNAT IP in networkinfo CR #1018
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1018 +/- ##
==========================================
+ Coverage 74.24% 74.30% +0.05%
==========================================
Files 118 118
Lines 16398 16445 +47
==========================================
+ Hits 12175 12219 +44
- Misses 3453 3455 +2
- Partials 770 771 +1
|
Getting VPC Ppolicy Tier1 uplink port IP as NSX LB SNAT IP in order to present it in networkinfo CR loadBalancerIPAddresses field.
ba3170b
to
bbb2e85
Compare
@@ -679,6 +678,22 @@ func (s *VPCService) GetAVISubnetInfo(vpc model.Vpc) (string, string, error) { | |||
return path, cidr, nil | |||
} | |||
|
|||
func (s *VPCService) GetNSXLBSNATIP(vpc model.Vpc) (string, error) { | |||
log.V(2).Info("Get VPC NSX LB SNAT IP", "VPC", *vpc.Id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get -> Getting? seem the convention uses "Getting" before operation and "Got" after operation finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
Getting VPC Ppolicy -> policy
for i := range extendAttributes { | ||
if extendAttributes[i].Key != nil && *extendAttributes[i].Key == "IpAddresses" { | ||
if len(result.IntentPaths) == 1 { | ||
for _, ip := range extendAttributes[i].Values { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you move
if len(result.IntentPaths) == 1 before Line 91?
if if len(result.IntentPaths) != 1 {
continue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If extendAttributes[i].Values has multiple values, it seems you will use the first legal one.
is it possible to have multiple legal value?
for _, ip := range extendAttributes[i].Values { | ||
parts := strings.Split(ip, "/") | ||
if len(parts) != 2 { | ||
log.Info("Invalid tier1 uplink port IP found", "IP", ip, "Path", intentPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Error?
return "", err | ||
} | ||
|
||
for _, result := range results.Results { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we filter by entity_type=RealizedLogicalRouterPort?
setNSNetworkReadyCondition(ctx, r.Client, req.Namespace, nsMsgVPCAviSubnetError.getNSNetworkCondition(err)) | ||
return common.ResultRequeueAfter10sec, err | ||
} | ||
lbIP = aviSECIDR | ||
} else if lbProvider == vpc.NSXLB { | ||
nsxLBSNATIP, err = r.Service.GetNSXLBSNATIP(*createdVpc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we return the VPC Tier1 LB SNAT IP in CreateOrUpdateVPC func when checking the realization state of VPC?
we can avoid a new NSX API call to get VPC realization state again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also help check if VPC is created with AVI Subnet, we still can get the LB SNAT IP right?
Getting VPC policy Tier1 uplink port IP as NSX LB SNAT IP in order to present it in networkinfo CR loadBalancerIPAddresses field.
Test done:
NSX API output for vpc-vw8t for VPC T1 uplink and downlink Port info
This PR is to show
100.64.0.3
as loadBalancerIPAddresses SNAT IP for namespace: ns-1 which is associated with VPCvpc-vw8t